﻿using DotNetty.Buffers;
using QQ.Client;
using static QQ.Utils.MiscHelper;

namespace QQ.Packet.Request.TLV
{
    public class TLV0x1 : IRequest
    {
        private readonly QQDeviceConfig config;
        private short ip_ver { get; set; } = 1;
        public uint uin { get; set; }
        public TLV0x1(QQDeviceConfig config)
        {
            this.config = config;
        }
        public IByteBuffer Serialize() => Unpooled.Buffer()
            .WriteShort(ip_ver)
            .WriteInt(getRandomNumber())
            .WriteInt((int)uin)
            .WriteInt(getUTCTime())
            .WriteBytes(config.localIP)
            .WriteShort(0);
    }
}
